package com.liu.domain.base;

import java.io.Serializable;
import java.util.List;

/**
 * 返回数组信息
 *
 * @author LIU
 */
public class ArrayResult<T> extends BaseResult implements Serializable {
    /**
     * 对象集合
     */
    private List<T> data;

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public ArrayResult() {

    }

    private ArrayResult(boolean success, String msg) {
        this.setSuccess(success);
        this.setMsg(msg);
    }

    private ArrayResult(boolean success, List<T> data) {
        this.setSuccess(success);
        this.data = data;
    }

    public static ArrayResult error(String msg) {
        return new ArrayResult(false, msg);
    }

    public static <T> ArrayResult<T> success(List<T> data) {
        return new ArrayResult<T>(true, data);
    }
}
